﻿Shader "Custom/Draw"  
{  
    Properties  
    {  
		_Point1("Point1",vector) = (100,100,0,0)  
		_Point2("Point2",vector) = (200,200,0,0)  
    }  
    SubShader  
    {  
  
        Pass  
        {  
            CGPROGRAM  
            #pragma vertex vert  
            #pragma fragment frag  
             
            #include "UnityCG.cginc"  
            struct appdata  
            {  
                float4 vertex : POSITION;  
            };  
  
            struct v2f  
            {  
                float4 vertex : SV_POSITION;  
            };  
          
			float4 _Point1;  
			float4 _Point2; 
			float _LP1;
			float _LP2;
              
            v2f vert (appdata v)  
            {  
                v2f o;  
                o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); // UnityObjectToClipPos(v.vertex);  
                return o;  
            }  
              
            fixed4 frag (v2f i) : SV_Target  
            {  
				//绘制圆形，此处半径使用了固定值1000和500,当然大家也可以把他们写成可调的参数  
                if( pow((i.vertex.x- _Point1.x ),2) + pow((i.vertex.y- _Point1.y ),2) <1000   )  
                {  
                    return fixed4(0,1,0,1);  
                }  
                if( pow((i.vertex.x- _Point2.x ),2) + pow((i.vertex.y- _Point2.y ),2) <500   )  
                {  
                    return fixed4(1,0,0,1);  
                }  

                return fixed4(1,1,1,1); 
  
            }  
            ENDCG  
        }  
    }  
}  